//
//  FileManager.swift
//  vap_plugin
//
//  Created by sunc on 2024/5/28.
//

import Foundation
import UIKit
import Flutter

class FileManager: NSObject {

    var registrar : FlutterPluginRegistrar?
    
    
    static let shareInstance = FileManager()
    
    private override init() {
        super.init()
    }
    
    override class func copy() -> Any {
        return self
    }
    
    override class func mutableCopy() -> Any {
        return self
    }
    
    /// 获取flutter assets 文件绝对路径
    func handleFlutterSourcePath(assetpath : String) -> String {
        if registrar == nil  {
            return ""
        }
        
        return URL(string: Bundle.main.path(forResource: registrar?.lookupKey(forAsset: assetpath), ofType: nil) ?? "")?.absoluteString ?? ""
    }
    
}
